runOnStartup(async runtime => {
    runtime.addEventListener("tick", () => tick())
    runtime.getLayout("MainLevel").addEventListener("afterlayoutstart", () => init())
});
function tick() {
    if (runtime.layout.name != "MainLevel") return;
}
function init() {
    LoseGameLayerEffect.init()
    LoseGameLayerEffect.rebackPosistion()
}
globalThis.LoseGameLayerEffect = {
    init: function () {
        LoseGameLayerEffect.isMove = false
    },
    showEffect: function () {
        /**@type {ILayout} */
        let GameLayout = runtime.getLayout("MainLevel")
        /**@type {ILayer} */
        let loseLayer = GameLayout.getLayer("loseHUD")
        if (loseLayer.isVisible == true) {
            LoseGameLayerEffect.doMovetoEffect()
        }
    },
    doMovetoEffect: function () {
        /**@type {ISpriteInstance} */
        let CenterText
        /**@type {ISpriteInstance} */
        let Button
        /**@type {IMoveToBehaviorInstance} */
        let CenterTextMoveTo
        /**@type {IMoveToBehaviorInstance} */
        let ButtonMoveTo
        CenterText = runtime.objects.loseText.getFirstInstance()
        for (let ButtonText of runtime.objects.ButtonText.instances()) {
            /**@type {ISpriteInstance} */
            let getb = ButtonText
            if (getb.instVars.ID == 20) {
                /**@type {ITextInstance} */
                let getr_btx = getb
                Button = getr_btx.getParent()
            }
        }
        CenterTextMoveTo = CenterText.behaviors.MoveTo
        ButtonMoveTo = Button.behaviors.MoveTo
        if (LoseGameLayerEffect.isMove == false) {
            CenterTextMoveTo.moveToPosition(48, 19)
            ButtonMoveTo.moveToPosition(146, 145)
            LoseGameLayerEffect.isMove = true
        }
    },
    rebackPosistion: function () {
        /**@type {ISpriteInstance} */
        let CenterText
        /**@type {ISpriteInstance} */
        let Button
        CenterText = runtime.objects.loseText.getFirstInstance()
        for (let ButtonText of runtime.objects.ButtonText.instances()) {
            /**@type {ISpriteInstance} */
            let getb = ButtonText
            if (getb.instVars.ID == 20) {
                /**@type {ITextInstance} */
                let getr_btx = getb
                Button = getr_btx.getParent()
            }
        }
        CenterText.x = 48
        CenterText.y = -57
        Button.x = 146
        Button.y = 215
        LoseGameLayerEffect.isMove = false
    }
}
export default LoseGameLayerEffect